﻿using System.Configuration;
using JinJiang.BookingEngine.Services;

namespace JinJiang.BookingEngine.Web.en
{
    public class CommonFun
    {
        public string GetBreakFast(int num, string ccode, double price, int language)
        {
            object breakfastObj;
            var breakfast = "";
            var temp = new[]
                           {
                               "无早", "单早", "双早", "三早", "四早", "五早", "六早", "七早", "八早", "九早"
                           };
            if (language == 0)
            {
                if (num < 10)
                {
                    breakfast = "<br/>" + temp[num];
                }
                else
                {
                    breakfast = "<br/>" + num + "早";
                }
                if (price > 0.0)
                {
                    breakfastObj = breakfast;
                    breakfast = string.Concat(new[]
                                                  {
                                                      breakfastObj, "<br>另加早餐一份", ccode, price
                                                  });
                }
                return breakfast;
            }
            if (num > 0)
            {
                breakfast = "<br/>\x00d7" + num + " Breakfast included";
                if (price > 0.0)
                {
                    breakfastObj = breakfast;
                    breakfast = string.Concat(new[]
                                                  {
                                                      breakfastObj, "<br>Extra buffet breakfast:", ccode, price
                                                  });
                }
            }
            return breakfast;
        }

        public static string IATA()
        {
            if (LoginInfo.LoginName != "")
            {
                return ConfigurationManager.AppSettings["PIATA"];
            }
            return ConfigurationManager.AppSettings["IATA"];
        }
    }
}